import tkinter as tk



# 创建Form
root = tk.Tk()
root.title("用户登录")
root.geometry("400x300")
root.maxsize(400, 300)

# 创建按钮
btn = tk.Button(root, text="切换状态", width=10, height=2)
btn.pack()

# 按钮绑定事件，切换可用和不可用
def changeState(event):
    if btn["state"] == tk.NORMAL:
        btn["state"] = tk.DISABLED
    else:
        btn["state"] = tk.NORMAL

btn.bind("<Button-1>", changeState)


# 运行
root.mainloop()